package me.DonglinPu.COMP2039;

import java.io.IOException;

public class Main {	
	static final String INPUT = "random-protein-1331573826";
	
	public static void main(String[] args){
		try {
			//Test t = new Test();
//			Data.writeProteins();
			for(int i = 0; i < 50; i++){
				Data.randomTrainingSet();
				System.out.println(i);
				HelixPrediction helixPrediction = new HelixPrediction();
				SheetPrediction sheetPrediction = new SheetPrediction();
			}
//			Data.writeBinary("h", INPUT, OUTPUT_HELIX);//run in Data.writeProteins()
//			Data.writeBinary("e", INPUT, OUTPUT_SHEET);//run in Data.writeProteins()
		} catch (IOException e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}
//		double p = 1090.0;
//		double n = 748.0+5875.0;
//		double o = 424.0+613.0;
//		double u = 346.0+386.0+1801.0+1390.0;
//		
//		System.out.println(calculate_cc(p, n, o, u));
	}
	
	public static double calculate_cc(double p, double n, double o, double u) {
		double pn = p*n;
		double ou = o*u;
		double pPo = p+o;
		double pPu = p+u;
		double nPo = n+o;
		double nPu = n+u;

		double to_be_sqrt = (pPo*pPu*nPo*nPu);
		double top = pn - ou;
		return top/Math.sqrt(to_be_sqrt);
	}
	
	
	/*
	 * LOG:
	 * ==========
	 * 2012.3.10 5:22pm 
	 * Learning rate: 0.1 initial weight: 0.2
	 * HELIX correct prediction = 0.2975421154377244
	 * HELIX cc=0.06921521809560993
	 * SHEET correct prediction = 0.764153548743441
	 * SHEET cc=0.11455042680537664
	 * 
	 * 2012.3.12 11:48am
	 * Learning rate: 0.1 initial weight: 0.1
	 * HELIX correct prediction = 0.3156034244683789
	 * HELIX cc=0.09023248619830818
	 * SHEET correct prediction = 0.7791217895608947
	 * SHEET cc=0.07872072321722308
	 * 
	 * 2012.3.12 11:51am
	 * Learning rate = 0.1 initial weight: -0.1
	 * HELIX correct prediction = 0.35647611157138914
	 * HELIX cc=0.09837590279057937
	 * SHEET correct prediction = 0.7733222866611433
	 * SHEET cc=0.07844816604675717
	 */
}
